<template>
  <BackgroundImage>
    <view class="example-container">
      <!-- 示例标题 -->
      <view class="example-header">
        <text class="title">背景组件使用示例</text>
        <text class="subtitle">BackgroundImage Component Example</text>
      </view>

      <!-- 示例卡片 1：基础卡片 -->
      <view class="glass-card">
        <view class="card-header">
          <text class="card-title">✨ 玻璃态卡片</text>
        </view>
        <view class="card-body">
          <text class="card-text">
            这是一个使用了玻璃态效果的卡片。
            背景是半透明的，并带有模糊效果。
          </text>
        </view>
      </view>

      <!-- 示例卡片 2：功能卡片 -->
      <view class="glass-card">
        <view class="card-header">
          <text class="card-title">🎯 功能特点</text>
        </view>
        <view class="card-body">
          <view class="feature-item">
            <text class="feature-icon">✅</text>
            <text class="feature-text">自动适配背景图片</text>
          </view>
          <view class="feature-item">
            <text class="feature-icon">✅</text>
            <text class="feature-text">支持自定义透明度</text>
          </view>
          <view class="feature-item">
            <text class="feature-icon">✅</text>
            <text class="feature-text">多平台兼容</text>
          </view>
          <view class="feature-item">
            <text class="feature-icon">✅</text>
            <text class="feature-text">玻璃态模糊效果</text>
          </view>
        </view>
      </view>

      <!-- 示例卡片 3：按钮组 -->
      <view class="glass-card">
        <view class="card-header">
          <text class="card-title">🔘 按钮示例</text>
        </view>
        <view class="card-body">
          <view class="button-group">
            <button class="glass-button primary">主要按钮</button>
            <button class="glass-button secondary">次要按钮</button>
            <button class="glass-button success">成功按钮</button>
          </view>
        </view>
      </view>

      <!-- 示例卡片 4：输入框 -->
      <view class="glass-card">
        <view class="card-header">
          <text class="card-title">📝 输入框示例</text>
        </view>
        <view class="card-body">
          <input 
            class="glass-input" 
            placeholder="请输入内容..."
            placeholder-style="color: #999;"
          />
          <textarea 
            class="glass-textarea" 
            placeholder="多行文本输入..."
            placeholder-style="color: #999;"
          />
        </view>
      </view>

      <!-- 示例卡片 5：使用说明 -->
      <view class="glass-card info">
        <view class="card-header">
          <text class="card-title">💡 使用说明</text>
        </view>
        <view class="card-body">
          <text class="info-text">
            1. 将背景图片放入 src/static/background.png
          </text>
          <text class="info-text">
            2. 使用 BackgroundImage 组件包裹内容
          </text>
          <text class="info-text">
            3. 为元素添加玻璃态样式
          </text>
          <text class="info-text">
            4. 运行项目查看效果
          </text>
        </view>
      </view>

      <!-- 底部说明 -->
      <view class="example-footer">
        <text class="footer-text">✨ 查看 README_BACKGROUND.md 了解更多</text>
      </view>
    </view>
  </BackgroundImage>
</template>

<script setup>
import BackgroundImage from './BackgroundImage.vue'
</script>

<style lang="scss" scoped>
.example-container {
  min-height: 100vh;
  padding: 40rpx;
}

// 头部样式
.example-header {
  text-align: center;
  margin-bottom: 40rpx;
  padding: 40rpx 20rpx;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-radius: 20rpx;
  box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);

  .title {
    display: block;
    font-size: 48rpx;
    font-weight: bold;
    color: #333;
    margin-bottom: 15rpx;
  }

  .subtitle {
    display: block;
    font-size: 24rpx;
    color: #999;
    letter-spacing: 2rpx;
  }
}

// 玻璃态卡片
.glass-card {
  margin-bottom: 30rpx;
  padding: 30rpx;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16rpx;
  box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1);
  border: 1rpx solid rgba(255, 255, 255, 0.3);

  &.info {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.3);
  }
}

.card-header {
  margin-bottom: 20rpx;
  padding-bottom: 15rpx;
  border-bottom: 1rpx solid rgba(0, 0, 0, 0.05);

  .card-title {
    font-size: 32rpx;
    font-weight: bold;
    color: #333;
  }
}

.card-body {
  .card-text {
    display: block;
    font-size: 28rpx;
    color: #666;
    line-height: 1.6;
  }
}

// 功能列表
.feature-item {
  display: flex;
  align-items: center;
  margin-bottom: 15rpx;

  &:last-child {
    margin-bottom: 0;
  }

  .feature-icon {
    font-size: 32rpx;
    margin-right: 15rpx;
  }

  .feature-text {
    font-size: 28rpx;
    color: #666;
  }
}

// 按钮组
.button-group {
  display: flex;
  flex-direction: column;
  gap: 15rpx;
}

.glass-button {
  width: 100%;
  padding: 20rpx;
  border: none;
  border-radius: 12rpx;
  font-size: 28rpx;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  transition: all 0.3s;

  &:active {
    transform: translateY(2rpx);
    box-shadow: 0 1rpx 4rpx rgba(0, 0, 0, 0.1);
  }

  &.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
  }

  &.secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
  }

  &.success {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #fff;
  }
}

// 输入框样式
.glass-input,
.glass-textarea {
  width: 100%;
  padding: 20rpx;
  margin-bottom: 15rpx;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1rpx solid rgba(0, 0, 0, 0.1);
  border-radius: 10rpx;
  font-size: 28rpx;
  color: #333;
  box-sizing: border-box;

  &:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4rpx rgba(102, 126, 234, 0.1);
  }

  &:last-child {
    margin-bottom: 0;
  }
}

.glass-textarea {
  min-height: 150rpx;
  line-height: 1.5;
}

// 信息文本
.info-text {
  display: block;
  font-size: 26rpx;
  color: #666;
  line-height: 2;
  padding-left: 30rpx;
  position: relative;

  &::before {
    content: '•';
    position: absolute;
    left: 10rpx;
    color: #667eea;
    font-weight: bold;
  }
}

// 底部样式
.example-footer {
  margin-top: 40rpx;
  padding: 30rpx;
  text-align: center;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16rpx;
  box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1);

  .footer-text {
    display: block;
    font-size: 28rpx;
    color: #667eea;
    font-weight: bold;
  }
}

/* 响应式适配 */
@media screen and (max-width: 750rpx) {
  .example-header .title {
    font-size: 40rpx;
  }

  .button-group {
    flex-direction: column;
  }
}
</style>

